//
//  TableFoorterView.m
//  didacar
//
//  Created by 度周末网络-王腾 on 16/1/12.
//  Copyright © 2016年 dzmmac. All rights reserved.
//

#import "TableFoorterView.h"
#import "UIScreen+Frame.h"
#import "AppConfig.h"
#import "GTCommontHeader.h"
@implementation TableFoorterView

-(id)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        
    }
    return self;
}

-(CGFloat)setDataSource:(NSMutableArray *)dataSource{
    self.dayTicket = [[CalendarViewController alloc ] init];
  
    [self.dayTicket responseDayModels:dataSource];
    self.dayTicket.view.frame = CGRectMake(0, 0, [UIScreen width], 0);
    
    self.dayTicket.collectionView.scrollEnabled = NO;
//    self.dayTicket.collectionView.userInteractionEnabled = NO;
   
    [self addSubview:self.dayTicket.view];
    CGFloat totalHeight = 0;
    CGFloat headerHeight = self.dayTicket.calendarMonth.count * 65;
    totalHeight = headerHeight;
    for (NSInteger i =0; i < self.dayTicket.calendarMonth.count; i ++) {
        
        NSInteger listCount = [self.dayTicket.calendarMonth[i] count];
        CGFloat count = (listCount % 7) != 0 ? listCount / 7+ 1 : listCount / 7;
        totalHeight += GTFixHeightFloat(55.5)*count;
    }
    [self.dayTicket ajustFrame:CGRectMake(0, 0,  [UIScreen width], totalHeight)];
    return totalHeight;
    
    
}

@end
